package com.neusoft.rental.mapper;

import com.neusoft.rental.po.Information;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface InformationMapper {

    //查询所有的此用户的消息
    @Select("select * from information where userid=#{userid} order by time desc")
    public List<Information> queryinformation(String userid);

    //更新用户阅读状态，如未读isTrue等于0变为已读1
    @Update("update information set isTrue=1 where id=#{id}")
    public int readInformation(int id);

    //用于系统通知用户预约情况的，增加信息
    @Insert("insert into information values(null,#{userid},#{resource},#{content},#{time},#{isTrue})")
    public int addInformation(Information information);
}
